<?php

include dirname(__FILE__).'/../bootstrap/unit_context.php';

$test = new lime_test(4, new lime_output_color());

new sfDatabaseManager($configuration);

$table = Doctrine::getTable('Carrera');

$carrera = $table->find(1);
$carrera->denominacion = 'test' . rand();

$test->isnt($carrera, null, 'La carrera existe id 1');

$version = $carrera->version;
$carrera->save();
$carrera_version = $table->getVersion($carrera->id, $carrera->version);

$test->is($carrera->version, $version + 1, 'El numero de version de la carrera ha cambiado');
$test->isnt($carrera_version, null, 'La version de carrera existe');
$test->is($carrera->denominacion, $carrera_version->denominacion);
